package com.pactera.controller;

import java.util.List;

import com.pactera.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.pactera.service.UserService;


@Controller
@RequestMapping("/user")
public class UserController {
	private static final Logger log = LoggerFactory.getLogger(UserController.class);
	
	@Autowired
	UserService userService;

	@RequestMapping("/list")
	public ModelAndView showList(String id){
        ModelAndView mv = new ModelAndView();
		List<User> list = null;
		try {
			list = userService.getUserList();
		} catch (Exception e) {
			e.printStackTrace();
			log.error("查询用户集合失败："+e.getMessage(),e);
		}
		mv.addObject("list",list);
		mv.setViewName("userList");
		return mv;
	}
}
